﻿using Biz.Utility;

namespace Biz.Treat
{
    public abstract class TreatContent : IProduct
    {
        private int id = Define.NEW;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }
        private string ourEmployee = string.Empty;

        public string OurEmployee
        {
            get { return ourEmployee; }
            set { ourEmployee = value; }
        }
        private int numberOfUs = 0;

        public int NumberOfUs
        {
            get { return numberOfUs; }
            set { numberOfUs = value; }
        }
        private int numOfPerson = 0;

        public int NumOfPerson
        {
            get { return numOfPerson; }
            set { numOfPerson = value; }
        }
        private decimal averageAmount = 0;

        public decimal AverageAmount
        {
            get { return averageAmount; }
            set { averageAmount = value; }
        }
        private decimal totalAmount = 0;

        public decimal TotalAmount
        {
            get { return totalAmount; }
            set { totalAmount = value; }
        }
        private decimal actualFee = 0;

        public decimal ActualFee
        {
            get { return actualFee; }
            set { actualFee = value; }
        }

        public enum TreatType
        {
            Dinner,
            Golf,
            GolfMatch,
            OtherTreat,
            Party
        }
        
        /// <summary>
        /// #设计模式#模板模式
        /// </summary>
        public void Calculate()
        {
            averageAmount = CalculateAverageAmount();
            numOfPerson = CalculateNumOfPerson();
            totalAmount = CalculateTotalAmount();
        }

        public decimal CalculateTotalAmount()
        {
            return CalculateAverageAmount() * CalculateNumOfPerson();
        }
        
        public abstract decimal CalculateAverageAmount();
        public abstract int CalculateNumOfPerson();

        public abstract void save();

        public abstract void load(int _id);

        public abstract string PRODUCT_NAME
        {
            get;
        }
    }
}
